package com.goods.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.goods.dao.CpspMapper;
import com.goods.pojo.CpspBean;
import com.goods.service.ICpspService;
import com.somtacode.core.base.result.ResponseDataResult;

@Service
public class CpspServiceImpl implements ICpspService{

	@Autowired
	private CpspMapper cpspMapper;

	@Override
	public ResponseDataResult addCpsp(CpspBean cpsp) {
		cpspMapper.addCpsp(cpsp);
		return ResponseDataResult.setResponseResult();
	}

	@Override
	public ResponseDataResult deleteCpsp(Integer id) {
		cpspMapper.deleteCpsp(id);
		return ResponseDataResult.setResponseResult();
	}

	@Override
	public ResponseDataResult updateCpsp(CpspBean cpsp) {
		cpspMapper.updateCpsp(cpsp);
		return ResponseDataResult.setResponseResult();
	}

	@Override
	public List<CpspBean> getCpsp(Integer id) {
		return cpspMapper.getCpsp(id);
	}

	@Override
	public PageInfo<CpspBean> listCpsp(Integer pageNum, Integer pageSize, CpspBean cpsp) {
		Page<CpspBean> page = PageHelper.startPage(pageNum,pageSize);
		this.cpspMapper.listCpsp(cpsp);
		return page.toPageInfo();
	}
	
}
